feat: support custom model definitions in realtime.connect()#90
Merged
AdirAmsalem merged 3 commits intomainfrom Feb 23, 2026
Merged
feat: support custom model definitions in realtime.connect()#90AdirAmsalem merged 3 commits intomainfrom
AdirAmsalem merged 3 commits intomainfrom
Conversation
Add CustomModelDefinition type that allows users to provide their own model configurations with arbitrary names, while preserving autocomplete for built-in models via models.realtime(). - Widen modelDefinitionSchema name field from literal union to z.string() - Add CustomModelDefinition type and export it from index - Update WebRTC stack to accept string modelName instead of RealTimeModels - Add unit tests for custom model definition validation - Add examples/sdk-core/realtime/custom-model.ts example
commit: |
infoshoc
approved these changes
Feb 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Allow users to provide custom model definitions to
realtime.connect()— useful for preview, experimental, or private models that aren't yet in the SDK registry.Built-in models (
models.realtime("mirage_v2"), etc.) retain full autocomplete.Usage
What changed
CustomModelDefinitiontype exported from the SDKrealtime.connect()accepts both built-in and custom model definitionsexamples/sdk-core/realtime/custom-model.ts)Note
Medium Risk
Broadening model-name validation from an enum to
stringchanges a core contract and could allow invalid model identifiers to reach the realtime backend, affecting connection behavior at runtime.Overview
realtime.connect()now accepts either a built-inModelDefinitionor a new exportedCustomModelDefinition, enabling realtime connections to preview/experimental/private models with arbitrary string names.To support this,
modelDefinitionSchemavalidation is widened to allow any stringname, and the WebRTC layer’smodelNametyping is loosened fromRealTimeModelstostring. This PR also adds a browser-only example (examples/sdk-core/realtime/custom-model.ts), updates the examples README, and introduces unit tests covering custom-model schema validation.Written by Cursor Bugbot for commit 46522a2. This will update automatically on new commits. Configure here.